package com.kucai.yifaqapp.presenter.activity;

import com.kucai.yifaqapp.global.HttpAdress;
import com.kucai.yifaqapp.model.CustomObserver;
import com.kucai.yifaqapp.model.network.HttpJsonUtils;
import com.kucai.yifaqapp.model.network.entity.res.ResBanner;
import com.kucai.yifaqapp.ui.activity.AlllotteryActivity;
import com.kucai.yifaqapp.util.SYSOUtils;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

public class AlllotteryActivityPresenter extends BaseActivityPresenter<AlllotteryActivity> {
    public AlllotteryActivityPresenter(AlllotteryActivity mActivity) {
        super(mActivity);
    }


    //获取首页banner
    public void getbanner() {
        HttpJsonUtils.getHttpApiInstance()
                .getbanner(HttpAdress.getuseAdress() + "api/m/lottery/getHomeLotteryData")
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new CustomObserver<ResBanner>(mActivity) {

                    @Override
                    protected void onCustomNext(ResBanner resBanner) {
                        SYSOUtils.sOut_("全部彩种" + resBanner);
                        mActivity.getBanner(resBanner);
                    }

                    @Override
                    protected void onSubscribeCustom(Disposable disposable) {
                    }

                    @Override
                    protected void onErrorCustom(Throwable e) {

                    }
                });
    }
}
